/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.elcom.emocbc.cbcdb.dao;

import com.elcom.emocbc.cbcdb.tables.CellInfo;
import com.elcom.emocbc.cbcdb.tables.records.CellInfoRecord;
import com.elcom.util.DBUtil;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;
import org.jooq.DSLContext;
import org.jooq.SQLDialect;
import org.jooq.impl.DSL;

/**
 *
 * @author GiangLT
 */
public class CellInfoDao extends BaseDao<CellInfoRecord>{

    private CellInfo CELL_INFO = CellInfo.CELL_INFO;
    @Override
    protected String getInsertSql(CellInfoRecord record, DSLContext context) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
    
    public List<CellInfoRecord> getCells(String bscId) throws SQLException {
        Connection con = DBUtil.getConnection(JNDI);

        try {
            DSLContext context = DSL.using(con, SQLDialect.MYSQL);
            return context.selectFrom(CELL_INFO).where(CELL_INFO.BSC_ID.eq(bscId)).fetch();
        } finally {
            DbAccess.closeConnection(con);
        }
    }
    
}
